<!DOCTYPE html>
<html>
    <header>
        
        <title id = "title">H5页</title>
        
        <style>
            
            #buttonId{
                width: 200px;
                height: 200px;
            }
        #pTitle{
            width: 400px;
            height: 200px;
            background-color:red;
        }
        </style>
        
        
    </header>
    
    <body>
        
        <input id="buttonId" type="button" value="按钮"  onclick="sck()">
            <input type="file" name="cover" accept="image/*" capture="camera"/>
       <p id="pTitle">11111</p>

            
            <script type="text/javascript">
                
                
                function sck(){
                    window.webkit.messageHandlers.pushViewController.postMessage("https://www.xxxx.com");//传入url 因示例所以传了个本地
                }
            
            
                window.webkit.messageHandlers.getDeviceToken.postMessage("");//去客户端拿deviceToken从下面的方法返回得到
                function getDeviceTokenFunc(d) {//deviceToken获取deviceToken
                           
                           //保存deiceToken给服务器推送就可以
                        var x = document.getElementById("pTitle");
                        x.innerHTML = d;
                      
                }
            
            
                window.webkit.messageHandlers.rightBarButtonItemWithTitle.postMessage("h5按钮");
                function pressRightButton() {
                           
                        var x = document.getElementById("pTitle");
                        x.innerHTML = "点了右按钮";
                      
                }
            
<!--            window.webkit.messageHandlers.loginViewControllerFunc.postMessage("");-->

                function pressBackButton(){
                window.webkit.messageHandlers.popViewControllerAnimatedFunc.postMessage("1");
                }
            
<!--            window.webkit.messageHandlers.openTheCameraFunc.postMessage("");-->//调用照相机
<!--               window.webkit.messageHandlers.openAlbumFunc.postMessage("");-->//调用相册

                function selectImage(image){

                }
            
            function imageDidCancel(){
                var x = document.getElementById("pTitle");
                x.innerHTML = "点了取消";
            }
            
                </script>
            
            
            
            
            </body>
    
    
    
</html>
